package com.example.aop;

import com.example.aop.service.DemoAnnotationService;
import com.example.aop.service.DemoMethodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@SpringBootApplication
@EnableAspectJAutoProxy
public class AopApplication implements ApplicationRunner {

    @Autowired
    private DemoAnnotationService demoAnnotationService;

    @Autowired
    private DemoMethodService demoMethodService;

    public static void main(String[] args) {
        SpringApplication.run(AopApplication.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        demoAnnotationService.add();
        demoMethodService.add();
    }
}
